<!DOCTYPE html>












  




<html class="theme-next gemini use-motion" lang="zh-CN">
<head>
  <!-- hexo-inject:begin --><!-- hexo-inject:end --><meta charset="UTF-8"/>
<meta name="google-site-verification" content="o9IkI77-fxkhBZW-n0ww9JALMCqdDbeTgdcXO_Bw4Zc" />
<meta name="baidu-site-verification" content="3frqY9KiVO" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<meta name="theme-color" content="#222">



  
  
  <link rel="stylesheet" href="/lib/needsharebutton/needsharebutton.css">










<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />



















  
  
  
  

  
    
    
  

  
    
      
    

    
  

  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Monda:300,300italic,400,400italic,700,700italic|Roboto Slab:300,300italic,400,400italic,700,700italic|Lobster Two:300,300italic,400,400italic,700,700italic|PT Mono:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.4.1" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/logo.png?v=6.4.1">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/logo.png?v=6.4.1">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/logo.png?v=6.4.1">


  <link rel="mask-icon" href="/images/logo.svg?v=6.4.1" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '6.4.1',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="摘要：在数据科学中，统计地位尤为显著。其在数据分析的基础上，研究如何测定、收集、整理、归纳和分析反映数据规律，以便给出正确消息的科学。通过揭示数据背后的规律和隐藏信息，给相关角色提供参照价值，做出相应的决策。这在数据挖掘、自然语言处理、机器学习都广泛应用。本文主要介绍概率分布，让读者最短时间掌握基本的统计知识。（本文原创，转载必须注明出处.）">
<meta name="keywords" content="数学,统计学,几何分布,正态分布,泊松分布">
<meta property="og:type" content="article">
<meta property="og:title" content="编程数学之概率分布">
<meta property="og:url" content="https://bainingchao.github.io/2018/10/10/编程数学之概率分布/index.html">
<meta property="og:site_name" content="白宁超的官网">
<meta property="og:description" content="摘要：在数据科学中，统计地位尤为显著。其在数据分析的基础上，研究如何测定、收集、整理、归纳和分析反映数据规律，以便给出正确消息的科学。通过揭示数据背后的规律和隐藏信息，给相关角色提供参照价值，做出相应的决策。这在数据挖掘、自然语言处理、机器学习都广泛应用。本文主要介绍概率分布，让读者最短时间掌握基本的统计知识。（本文原创，转载必须注明出处.）">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://i.imgur.com/fNXNCuM.png">
<meta property="og:image" content="https://i.imgur.com/P87YVRK.png">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?P(X=r)=^{n}\textrm{C}_r \times p^r \times q^{n-r},(r=0,1,...,n)">
<meta property="og:image" content="https://i.imgur.com/4ABgiJA.png">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?E(X)=np ">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?Var(X)=npq,(q=1-p) ">
<meta property="og:image" content="https://i.imgur.com/WFX9P6O.png">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?{\displaystyle f(x)={1 \over \sigma {\sqrt {2\pi }}}\,e^{-{(x-\mu )^{2} \over 2\sigma ^{2}}}}">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?{\displaystyle f(x)={1 \over \sigma {\sqrt {2\pi }}}\,e^{-{(x-\mu )^{2} \over 2\sigma ^{2}}}}">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?{\displaystyle f(x)={1 \over {\sqrt {2\pi }}}\,e^{-{x^{2} \over 2}}}">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?E(X)=\mu ">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?Var(X)=\sigma^2 ">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?{\displaystyle P(X=k)={\frac {e^{-\lambda }\lambda ^{k}}{k!}}}  ">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?P(X=k)=\frac{e^{-\lambda}\lambda^k}{k!},(k=0,1,...,n)">
<meta property="og:image" content="https://i.imgur.com/vdViO7B.png">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?E(X)=\lambda ">
<meta property="og:image" content="http://latex.codecogs.com/gif.latex?Var(X)=\lambda ">
<meta property="og:image" content="http://pub.idqqimg.com/wpa/images/group.png">
<meta property="og:image" content="https://i.imgur.com/cvixeiT.png">
<meta property="og:updated_time" content="2018-10-19T07:42:02.474Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="编程数学之概率分布">
<meta name="twitter:description" content="摘要：在数据科学中，统计地位尤为显著。其在数据分析的基础上，研究如何测定、收集、整理、归纳和分析反映数据规律，以便给出正确消息的科学。通过揭示数据背后的规律和隐藏信息，给相关角色提供参照价值，做出相应的决策。这在数据挖掘、自然语言处理、机器学习都广泛应用。本文主要介绍概率分布，让读者最短时间掌握基本的统计知识。（本文原创，转载必须注明出处.）">
<meta name="twitter:image" content="https://i.imgur.com/fNXNCuM.png">



  <link rel="alternate" href="/atom.xml" title="白宁超的官网" type="application/atom+xml" />




  <link rel="canonical" href="https://bainingchao.github.io/2018/10/10/编程数学之概率分布/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>编程数学之概率分布 | 白宁超的官网</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript><!-- hexo-inject:begin --><!-- hexo-inject:end -->

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <!-- hexo-inject:begin --><!-- hexo-inject:end --><div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

	<!-- <a href="https://github.com/bainingchao"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a> !-->
	
    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">白宁超的官网</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <h1 class="site-subtitle" itemprop="description">专注人工智能领域研究</h1>
      
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-首页">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br />首页</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-标签">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />标签</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-分类">
    <a href="/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br />分类</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-归档">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />归档</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-视频">
    <a href="/videos/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-sitemap"></i> <br />视频</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-书籍">
    <a href="/books/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br />书籍</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-链接">
    <a href="/links/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />链接</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-关于">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br />关于</a>
  </li>

      
      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />搜索</a>
        </li>
      
    </ul>
  

  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://bainingchao.github.io/2018/10/10/编程数学之概率分布/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="白宁超">
      <meta itemprop="description" content="本站主要研究深度学习、机器学习、自然语言处理等前沿技术。ML&NLP交流群：436303759 <span><a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=ef3bbb679b06ac59b136c57ba9e7935ff9d3b10faeabde6e4efcafe523bbbf4d"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="自然语言处理和机器学习技术QQ交流：436303759 " title="自然语言处理和机器学习技术交流"></a></span>">
      <meta itemprop="image" content="/../images/header.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="白宁超的官网">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">编程数学之概率分布
              
            
          </h2>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-10-10 19:21:20" itemprop="dateCreated datePublished" datetime="2018-10-10T19:21:20+08:00">2018-10-10</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2018-10-19 15:42:02" itemprop="dateModified" datetime="2018-10-19T15:42:02+08:00">2018-10-19</time>
              
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/数学/" itemprop="url" rel="index"><span itemprop="name">数学</span></a></span>

                
                
                  ，
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/数学/统计学/" itemprop="url" rel="index"><span itemprop="name">统计学</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon"
            >
            <i class="fa fa-eye"></i>
             阅读次数： 
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          
		  

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <blockquote>
<p>摘要：在数据科学中，统计地位尤为显著。其在数据分析的基础上，研究如何测定、收集、整理、归纳和分析反映数据规律，以便给出正确消息的科学。通过揭示数据背后的规律和隐藏信息，给相关角色提供参照价值，做出相应的决策。这在数据挖掘、自然语言处理、机器学习都广泛应用。本文主要介绍概率分布，让读者最短时间掌握基本的统计知识。（本文原创，转载必须注明出处.）</p>
</blockquote>
<a id="more"></a>
<h1 id="几何分布"><a href="#几何分布" class="headerlink" title="几何分布"></a>几何分布</h1><h2 id="定义"><a href="#定义" class="headerlink" title="定义"></a>定义</h2><p>几何分布是离散型概率分布，（如图所示）。在n次伯努利试验中，试验k次才得到第一次成功的机率。</p>
<p><img src="https://i.imgur.com/fNXNCuM.png" alt=""></p>
<p>详细的说，是：前k-1次皆失败，第k次成功的概率。几何分布公式如下：\(P(X=r)=q^{r-1}p\)</p>
<h2 id="计算公式"><a href="#计算公式" class="headerlink" title="计算公式"></a>计算公式</h2><p>成功概率为p，失败概率为q，试验次数为r，则有：</p>
<ol>
<li>第r次试验第一次成功：\( P(X=r)=pq^{r-1} \)</li>
<li>需要试验r次以上才第一次成功：\( P(X&gt;r)=q^{r} \)</li>
<li>试验r次或者不到r次才第一次成功：\( P(X&lt;r)=1-q^{r}\)</li>
</ol>
<h2 id="几何分布的条件"><a href="#几何分布的条件" class="headerlink" title="几何分布的条件"></a>几何分布的条件</h2><ol>
<li>进行一系列相互独立的实验。</li>
<li>每一次实验既有成功，又有失败的可能，且单次实验成功概率相等。</li>
<li>为了取得第一次成功需要进行多少次实验。</li>
</ol>
<h2 id="几何分布的期望"><a href="#几何分布的期望" class="headerlink" title="几何分布的期望"></a>几何分布的期望</h2><p>期望特点：随着x变大，累计总数和越来越接近一个特定值。\( E(X)=\frac{1}{p}\)</p>
<h2 id="几何分布的方差"><a href="#几何分布的方差" class="headerlink" title="几何分布的方差"></a>几何分布的方差</h2><p>方差特点：随着x变大，方差越来越接近特定值</p>
<script type="math/tex; mode=display">Var(X)=\frac{q}{p^2}</script><h2 id="应用范围"><a href="#应用范围" class="headerlink" title="应用范围"></a>应用范围</h2><ul>
<li>应用科学：数学以及相关领域</li>
<li>适用领域范围：自然数学，应用数学，高等数学，概率论</li>
<li>射击比赛等</li>
</ul>
<hr>
<h1 id="二项分布"><a href="#二项分布" class="headerlink" title="二项分布"></a>二项分布</h1><h2 id="定义-1"><a href="#定义-1" class="headerlink" title="定义"></a>定义</h2><p>二项分布即重复n次独立的伯努利试验。在每次试验中只有两种可能的结果，而且两种结果发生与否互相对立，并且相互独立，与其它各次试验结果无关，事件发生与否的概率在每一次独立试验中都保持不变。</p>
<p><img src="https://i.imgur.com/P87YVRK.png" alt=""></p>
<h2 id="计算公式-1"><a href="#计算公式-1" class="headerlink" title="计算公式"></a>计算公式</h2><p>在相互独立事件中，每道题答对概率为p，答错概率为q。在n个问题中答对r个问题的概率为二项分布，表达式是\( X\sim B(n,p)\) X表示n次随机变量ξ次成功数，p表示成功的概率。计算公式：</p>
<p><img src="http://latex.codecogs.com/gif.latex?P(X=r)=^{n}\textrm{C}_r \times p^r \times q^{n-r},(r=0,1,...,n)"></p>


<h2 id="二项分布的条件"><a href="#二项分布的条件" class="headerlink" title="二项分布的条件"></a>二项分布的条件</h2><ol>
<li>正在进行一系列独立试验；</li>
<li>每次试验都可能失败和成功，每一次成功概率相同。</li>
<li>试验次数有限。</li>
</ol>
<h2 id="二项分布形状特点，如图所示"><a href="#二项分布形状特点，如图所示" class="headerlink" title="二项分布形状特点，如图所示"></a>二项分布形状特点，如图所示</h2><p><img src="https://i.imgur.com/4ABgiJA.png" alt=""></p>
<p>P<0.5时图形向右偏移；当p>0.5时，图形向左偏移。</0.5时图形向右偏移；当p></p>
<h2 id="优缺点"><a href="#优缺点" class="headerlink" title="优缺点"></a>优缺点</h2><ul>
<li>优点：在试验次数一定，求成功次数时，几何分布显示不适合的情况下，给予这类问题二项分布能更好的解决。</li>
<li>缺点：但是面对试验次数不固定，发生事件概率的情况下，显然几何分布与二项分布都不能解决，这里也体现出泊松分布的优势</li>
</ul>
<h2 id="二项分布的期望"><a href="#二项分布的期望" class="headerlink" title="二项分布的期望"></a>二项分布的期望</h2><p><img src="http://latex.codecogs.com/gif.latex?E(X)=np "></p>

<h2 id="几何分布的方差-1"><a href="#几何分布的方差-1" class="headerlink" title="几何分布的方差"></a>几何分布的方差</h2><p><img src="http://latex.codecogs.com/gif.latex?Var(X)=npq,(q=1-p) "></p>

<h2 id="应用范围-1"><a href="#应用范围-1" class="headerlink" title="应用范围"></a>应用范围</h2><ul>
<li>应用科学：数学以及相关领域</li>
<li>适用领域范围：自然数学，应用数学，高等数学，概率论</li>
<li>射击比赛等</li>
</ul>
<hr>
<h1 id="正态分布"><a href="#正态分布" class="headerlink" title="正态分布"></a>正态分布</h1><h2 id="正态分布描述"><a href="#正态分布描述" class="headerlink" title="正态分布描述"></a>正态分布描述</h2><p>正态分布又名高斯分布, 以德国数学家卡尔·弗里德里希·高斯的姓冠名，是一个在数学、物理及工程等领域都非常重要的概率分布，由于这个分布函数具有很多非常漂亮的性质，使得其在诸多涉及统计科学离散科学等领域的许多方面都有着重大的影响力。比如图像处理中最常用的正态分布函数，下图是正态分布示意图。</p>
<p><img src="https://i.imgur.com/WFX9P6O.png" alt=""></p>
<p>若随机变量\( X \)服从一个位置参数为 \( \mu\)、尺度参数为\(\sigma\) 的概率分布，记为：\( X\sim N(\mu ,\sigma ^{2})\),则其概率密度函数为</p>
<p><img src="http://latex.codecogs.com/gif.latex?{\displaystyle f(x)={1 \over \sigma {\sqrt {2\pi }}}\,e^{-{(x-\mu )^{2} \over 2\sigma ^{2}}}}"></p>


<p>正态分布的数学期望值或期望值\( \mu\)等于位置参数，决定了分布的位置；其方差\(\sigma^2\) 的开平方或标准差\(\sigma\) 等于尺度参数，决定了分布的幅度。</p>
<h2 id="定义-2"><a href="#定义-2" class="headerlink" title="定义"></a>定义</h2><p>正态分布概率函数密度曲线可以表示为：</p>
<p><img src="http://latex.codecogs.com/gif.latex?{\displaystyle f(x)={1 \over \sigma {\sqrt {2\pi }}}\,e^{-{(x-\mu )^{2} \over 2\sigma ^{2}}}}"></p>

<p>称\(X\)服从正态分布，记为\(X \sim N(m,s_2)\)，其中\(\mu\)为均值，\(\sigma\)为标准差。标准正态分布另正态分布：\( \mu=0\),\( \sigma=1 \)，公式简化为：</p>
<p><img src="http://latex.codecogs.com/gif.latex?{\displaystyle f(x)={1 \over {\sqrt {2\pi }}}\,e^{-{x^{2} \over 2}}}"></p>


<h2 id="正态分布特点"><a href="#正态分布特点" class="headerlink" title="正态分布特点"></a>正态分布特点</h2><ul>
<li>正态分布函数密度曲线在横轴上方均数处最高。</li>
<li>正态分布函数密度曲线以均数为中心，左右对称。</li>
<li>正态分布函数密度曲线有两个参数，即均数（μ）和标准差（s）。μ是位置参数，当s固定不变时，μ越大，曲线沿横轴,越向右移动；反之，μ越小，则曲线沿横轴,越向左移动。是形状参数，当μ固定不变时，s越大，曲线越平阔；s越小，曲线越尖峭。通常用N表示均数为μ，方差为s的正态分布。用N（0，1）表示标准正态分布。</li>
<li>正态分布函数密度曲线下面积的总和为1。</li>
</ul>
<h2 id="正态分布的期望"><a href="#正态分布的期望" class="headerlink" title="正态分布的期望"></a>正态分布的期望</h2><p><img src="http://latex.codecogs.com/gif.latex?E(X)=\mu "></p>

<h2 id="几何分布的方差-2"><a href="#几何分布的方差-2" class="headerlink" title="几何分布的方差"></a>几何分布的方差</h2><p><img src="http://latex.codecogs.com/gif.latex?Var(X)=\sigma^2 "></p>

<h2 id="正态概率计算步骤"><a href="#正态概率计算步骤" class="headerlink" title="正态概率计算步骤"></a>正态概率计算步骤</h2><p>第一步：首先确定数据是否符合正态分布，确定正态分布的均值和方差。对一些不符和正态分布的数据进行取对数或者样本重新排列称符合正态分布的标准后，在确定均值和方差。</p>
<p>第二步：标准化（平移，收放）：对一般正态分布进行标准化，标准化的过程为先平移，平移过程用公式表达即\( x-\mu \)，再对结果进行收放，收放过程即\(\frac{y}{\sigma}\)，其中\(y=x-\mu \) 。则标准化公式：\(Z=\frac{(x-\mu)}{\sigma} \)；其中Z为标准分，\(X\)为随机变量，\(\mu\)为均值，\(\sigma\)为标准差。</p>
<p>第三步：使用概率表：通过标准分，进行查表（标准正态分布概率表），得到具体的概率。</p>
<h2 id="正态分布的优缺点"><a href="#正态分布的优缺点" class="headerlink" title="正态分布的优缺点"></a>正态分布的优缺点</h2><ul>
<li>优点：对于社会上遇到的大部分问题，其概率分布规律基本都满足正态分布，为了计算某种概率，我们就可以通过数学建模利用正态分布方便解决问题。</li>
<li>缺点：无法近似估算符合几何分布的问题，无法精确解决离散数据概率。</li>
</ul>
<h2 id="应用场景"><a href="#应用场景" class="headerlink" title="应用场景"></a>应用场景</h2><ul>
<li>不适合应用场景： 数据离散性太大，数据不符合正态分布特点，通过对数据进行取对数或者重新排序亦无法达到正态分布特点，无法得出均数（期望）和标准差。</li>
<li>适用场景：连续型数据或者数据离散性小，数据基本符合正态分布特点，或者对不符合的数据进行取对数或者样本重新排序达到正态分布特点，有具体的均数（期望）和标准差。</li>
</ul>
<h2 id="中心极限定理"><a href="#中心极限定理" class="headerlink" title="中心极限定理"></a>中心极限定理</h2><p>正态分布有一个非常重要的性质：在特定条件下，大量统计独立的随机变量的平均值的分布趋于正态分布，这就是中心极限定理。中心极限定理的重要意义在于，根据这一定理的结论，其他概率分布可以用正态分布作为近似。</p>
<ul>
<li>参数为n和 p的二项分布，在n相当大而且 p接近0.5时近似于正态分布。近似正态分布平均数为\(\mu=np\)，且方差为\( \sigma ^{2}=np(1-p)\)</li>
<li>泊松分布带有参数\(\lambda\)  当取样样本数很大时将近似正态分布\(\lambda\) 。近似正态分布平均数为 \(\mu=\lambda\) 且方差为\(\sigma^2=\lambda\)。</li>
</ul>
<hr>
<h1 id="泊松分布"><a href="#泊松分布" class="headerlink" title="泊松分布"></a>泊松分布</h1><h2 id="定义-3"><a href="#定义-3" class="headerlink" title="定义"></a>定义</h2><p>泊松分布适合于描述单位时间内随机事件发生的次数的概率分布。如某一服务设施在一定时间内受到的服务请求的次数，电话交换机接到呼叫的次数、汽车站台的候客人数、机器出现的故障数、自然灾害发生的次数、DNA序列的变异数、放射性原子核的衰变数、激光的光子数分布等等。泊松分布的概率质量函数为：</p>
<p><img src="http://latex.codecogs.com/gif.latex?{\displaystyle P(X=k)={\frac {e^{-\lambda }\lambda ^{k}}{k!}}}  "></p>

<p>泊松分布的参数λ是单位时间（或单位面积）内随机事件的平均发生率。</p>
<h2 id="计算公式-2"><a href="#计算公式-2" class="headerlink" title="计算公式"></a>计算公式</h2><p>X服从参数为\(\lambda\)的泊松分布，记为\( X\sim P(\lambda )\)。单独事件在给定区间随机独立发生，已知事件平均发生数且有限次数，通过以下计算： </p>
<p><img src="http://latex.codecogs.com/gif.latex?P(X=k)=\frac{e^{-\lambda}\lambda^k}{k!},(k=0,1,...,n)"></p>


<h2 id="泊松分布的条件"><a href="#泊松分布的条件" class="headerlink" title="泊松分布的条件"></a>泊松分布的条件</h2><ol>
<li>单独事件在给定区间内随机独立的发生，给定区别可以是时间或者空间。（一周、一英里）</li>
<li>已知该区间内的事件平均发生次数（发生率），且为有限数值。该事件平均发生次数用λ表示。</li>
</ol>
<h2 id="泊松分布形状特点"><a href="#泊松分布形状特点" class="headerlink" title="泊松分布形状特点"></a>泊松分布形状特点</h2><ul>
<li>不需要一系列试验，描述事件特定区间发生次数。</li>
<li>两个独立的泊松分布相加也符合泊松分布。（即n&gt;50且p&lt;0.1时或np近似等于npq时）。</li>
<li>特定条件下可以用来近似代替二项分布。</li>
</ul>
<p><img src="https://i.imgur.com/vdViO7B.png" alt=""></p>
<p>泊松分布形状特点：λ小时，分布向右偏斜；当λ大时，分布逐渐对称。</p>
<h2 id="优缺点-1"><a href="#优缺点-1" class="headerlink" title="优缺点"></a>优缺点</h2><p>不需要一系列试验，描述事件特定区间发生次数，特别适用。另外一定条件下替换二项分布带来简便的运算。</p>
<h2 id="泊松分布与二项分布关系"><a href="#泊松分布与二项分布关系" class="headerlink" title="泊松分布与二项分布关系"></a>泊松分布与二项分布关系</h2><p>当二项分布X~B(n,p)的n很大而p很小时，泊松分布可作为二项分布的近似，其中λ为np。通常当n≧10,p≦0.1，np&lt;=5时，就可以用泊松公式近似得计算，X可以近似表示X~Po（np）。</p>
<p>问题：为什么n要足够大，p要足够小？</p>
<p>因为在分时间窗口的时候有个假设：每个时间窗口最多只有一个乘客到达。(时间区间乘客问题)</p>
<h2 id="泊松分布的期望"><a href="#泊松分布的期望" class="headerlink" title="泊松分布的期望"></a>泊松分布的期望</h2><p><img src="http://latex.codecogs.com/gif.latex?E(X)=\lambda "></p>

<h2 id="几何分布的方差-3"><a href="#几何分布的方差-3" class="headerlink" title="几何分布的方差"></a>几何分布的方差</h2><p><img src="http://latex.codecogs.com/gif.latex?Var(X)=\lambda "></p>

<h2 id="应用范围-2"><a href="#应用范围-2" class="headerlink" title="应用范围"></a>应用范围</h2><ul>
<li>用学科：概率论</li>
<li>某一服务设施在一定时间内到达人数，电话交换机接到呼叫的次数，汽车站台的侯客人数，机器出现的故障次数，自然灾害发生次数，一块产品的缺陷，显微镜下单位分区内的细菌分布数等。</li>
<li>在交通工程的应用、非典流行与传播服从泊松分布</li>
<li>自然现象普遍存在泊松分布现象，主要指大量重复实验中稀有事件发生的次数。</li>
</ul>
<hr>
<h1 id="参考文献"><a href="#参考文献" class="headerlink" title="参考文献"></a>参考文献</h1><ol>
<li><a href="https://www.python.org/downloads/" target="_blank" rel="noopener">Python官网</a></li>
<li><a href="https://zh.wikipedia.org/wiki/Python" target="_blank" rel="noopener">中文维基百科</a></li>
<li><a href="https://github.com/BaiNingchao/MachineLearning-1" target="_blank" rel="noopener">GitHub</a></li>
<li>图书：《机器学习实战》</li>
<li><a href="https://baike.baidu.com/item/%E8%87%AA%E7%84%B6%E8%AF%AD%E8%A8%80%E5%A4%84%E7%90%86%E7%90%86%E8%AE%BA%E4%B8%8E%E5%AE%9E%E6%88%98" target="_blank" rel="noopener">图书：《自然语言处理理论与实战》</a></li>
</ol>
<h1 id="完整代码下载"><a href="#完整代码下载" class="headerlink" title="完整代码下载"></a>完整代码下载</h1><blockquote>
<p>源码请进【机器学习和自然语言QQ群：436303759】文件下载：<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=ef3bbb679b06ac59b136c57ba9e7935ff9d3b10faeabde6e4efcafe523bbbf4d"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="自然语言处理和机器学习技术QQ交流" title="自然语言处理和机器学习技术交流"></a></p>
</blockquote>
<p><img src="https://i.imgur.com/cvixeiT.png" alt=""></p>
<h1 id="作者声明"><a href="#作者声明" class="headerlink" title="作者声明"></a>作者声明</h1><blockquote>
<p>本文版权归作者所有，旨在技术交流使用。未经作者同意禁止转载，转载后需在文章页面明显位置给出原文连接，否则相关责任自行承担。</p>
</blockquote>

      
    </div>

    

    
    
    

    
      <div>
        <div id="wechat_subscriber" style="display: block; padding: 10px 0; margin: 20px auto; width: 100%; text-align: center">
    <img id="wechat_subscriber_qcode" src="/uploads/wechat.png" alt="白宁超 wechat" style="width: 200px; max-width: 100%;"/>
    <div>扫一扫关注微信公众号，机器学习和自然语言处理，订阅号datathinks！</div>
</div>

      </div>
    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div></div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wechatpay.jpg" alt="白宁超 微信支付"/>
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/alipay.jpg" alt="白宁超 支付宝"/>
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/数学/" rel="tag"><i class="fa fa-tag"></i> 数学</a>
          
            <a href="/tags/统计学/" rel="tag"><i class="fa fa-tag"></i> 统计学</a>
          
            <a href="/tags/几何分布/" rel="tag"><i class="fa fa-tag"></i> 几何分布</a>
          
            <a href="/tags/正态分布/" rel="tag"><i class="fa fa-tag"></i> 正态分布</a>
          
            <a href="/tags/泊松分布/" rel="tag"><i class="fa fa-tag"></i> 泊松分布</a>
          
        </div>
      

      
      
        <div class="post-widgets">
        

        

        
          
          <div class="social_share">
            
               <div>
                 
  <div class="bdsharebuttonbox">
    <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
    <a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a>
    <a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a>
    <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
    <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
    <a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a>
    <a href="#" class="bds_twi" data-cmd="twi" title="分享到Twitter"></a>
    <a href="#" class="bds_fbook" data-cmd="fbook" title="分享到Facebook"></a>
    <a href="#" class="bds_more" data-cmd="more"></a>
    <a class="bds_count" data-cmd="count"></a>
  </div>
  <script>
    window._bd_share_config = {
      "common": {
        "bdText": "",
        "bdMini": "2",
        "bdMiniList": false,
        "bdPic": ""
      },
      "share": {
        "bdSize": "16",
        "bdStyle": "0"
      },
      "image": {
        "viewList": ["tsina", "douban", "sqq", "qzone", "weixin", "twi", "fbook"],
        "viewText": "分享到：",
        "viewSize": "16"
      }
    }
  </script>

<script>
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

               </div>
            
            
               <div id="needsharebutton-postbottom">
                 <span class="btn">
                    <i class="fa fa-share-alt" aria-hidden="true"></i>
                 </span>
               </div>
            
          </div>
        
        </div>
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/10/10/编程数学之数据度量标准/" rel="next" title="编程数学之数据度量标准">
                <i class="fa fa-chevron-left"></i> 编程数学之数据度量标准
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/10/10/编程数学之相关与回归/" rel="prev" title="编程数学之相关与回归">
                编程数学之相关与回归 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  
    <div class="comments" id="comments">
      <div id="lv-container" data-id="city" data-uid="MTAyMC8zOTc5NC8xNjMyMQ=="></div>
    </div>

  
 





        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/../images/header.png"
                alt="白宁超" />
            
              <p class="site-author-name" itemprop="name">白宁超</p>
              <p class="site-description motion-element" itemprop="description">本站主要研究深度学习、机器学习、自然语言处理等前沿技术。ML&NLP交流群：436303759 <span><a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=ef3bbb679b06ac59b136c57ba9e7935ff9d3b10faeabde6e4efcafe523bbbf4d"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="自然语言处理和机器学习技术QQ交流：436303759 " title="自然语言处理和机器学习技术交流"></a></span></p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives">
                
                    <span class="site-state-item-count">65</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">29</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">119</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  <a href="https://github.com/bainingchao" target="_blank" title="GitHub" rel="external nofollow"><i class="fa fa-fw fa-github"></i>GitHub</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://www.google.com.hk/" target="_blank" title="Google" rel="external nofollow"><i class="fa fa-fw fa-google"></i>Google</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://www.baidu.com/" target="_blank" title="百度" rel="external nofollow"><i class="fa fa-fw fa-globe"></i>百度</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://weibo.com/p/1005056002073632?is_all=1" target="_blank" title="微博" rel="external nofollow"><i class="fa fa-fw fa-weibo"></i>微博</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="http://www.cnblogs.com/baiboy/" target="_blank" title="博客园" rel="external nofollow"><i class="fa fa-fw fa-globe"></i>博客园</a>
                  
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://mp.weixin.qq.com/s/s97I4gtEJIt5rMivWMkPkQ" target="_blank" title="微信公众号" rel="external nofollow"><i class="fa fa-fw fa-weixin"></i>微信公众号</a>
                  
                </span>
              
            </div>
          

          
          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#几何分布"><span class="nav-number">1.</span> <span class="nav-text">几何分布</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#定义"><span class="nav-number">1.1.</span> <span class="nav-text">定义</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#计算公式"><span class="nav-number">1.2.</span> <span class="nav-text">计算公式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#几何分布的条件"><span class="nav-number">1.3.</span> <span class="nav-text">几何分布的条件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#几何分布的期望"><span class="nav-number">1.4.</span> <span class="nav-text">几何分布的期望</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#几何分布的方差"><span class="nav-number">1.5.</span> <span class="nav-text">几何分布的方差</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#应用范围"><span class="nav-number">1.6.</span> <span class="nav-text">应用范围</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#二项分布"><span class="nav-number">2.</span> <span class="nav-text">二项分布</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#定义-1"><span class="nav-number">2.1.</span> <span class="nav-text">定义</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#计算公式-1"><span class="nav-number">2.2.</span> <span class="nav-text">计算公式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#二项分布的条件"><span class="nav-number">2.3.</span> <span class="nav-text">二项分布的条件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#二项分布形状特点，如图所示"><span class="nav-number">2.4.</span> <span class="nav-text">二项分布形状特点，如图所示</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#优缺点"><span class="nav-number">2.5.</span> <span class="nav-text">优缺点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#二项分布的期望"><span class="nav-number">2.6.</span> <span class="nav-text">二项分布的期望</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#几何分布的方差-1"><span class="nav-number">2.7.</span> <span class="nav-text">几何分布的方差</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#应用范围-1"><span class="nav-number">2.8.</span> <span class="nav-text">应用范围</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#正态分布"><span class="nav-number">3.</span> <span class="nav-text">正态分布</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#正态分布描述"><span class="nav-number">3.1.</span> <span class="nav-text">正态分布描述</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#定义-2"><span class="nav-number">3.2.</span> <span class="nav-text">定义</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#正态分布特点"><span class="nav-number">3.3.</span> <span class="nav-text">正态分布特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#正态分布的期望"><span class="nav-number">3.4.</span> <span class="nav-text">正态分布的期望</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#几何分布的方差-2"><span class="nav-number">3.5.</span> <span class="nav-text">几何分布的方差</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#正态概率计算步骤"><span class="nav-number">3.6.</span> <span class="nav-text">正态概率计算步骤</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#正态分布的优缺点"><span class="nav-number">3.7.</span> <span class="nav-text">正态分布的优缺点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#应用场景"><span class="nav-number">3.8.</span> <span class="nav-text">应用场景</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#中心极限定理"><span class="nav-number">3.9.</span> <span class="nav-text">中心极限定理</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#泊松分布"><span class="nav-number">4.</span> <span class="nav-text">泊松分布</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#定义-3"><span class="nav-number">4.1.</span> <span class="nav-text">定义</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#计算公式-2"><span class="nav-number">4.2.</span> <span class="nav-text">计算公式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#泊松分布的条件"><span class="nav-number">4.3.</span> <span class="nav-text">泊松分布的条件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#泊松分布形状特点"><span class="nav-number">4.4.</span> <span class="nav-text">泊松分布形状特点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#优缺点-1"><span class="nav-number">4.5.</span> <span class="nav-text">优缺点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#泊松分布与二项分布关系"><span class="nav-number">4.6.</span> <span class="nav-text">泊松分布与二项分布关系</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#泊松分布的期望"><span class="nav-number">4.7.</span> <span class="nav-text">泊松分布的期望</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#几何分布的方差-3"><span class="nav-number">4.8.</span> <span class="nav-text">几何分布的方差</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#应用范围-2"><span class="nav-number">4.9.</span> <span class="nav-text">应用范围</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#参考文献"><span class="nav-number">5.</span> <span class="nav-text">参考文献</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#完整代码下载"><span class="nav-number">6.</span> <span class="nav-text">完整代码下载</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#作者声明"><span class="nav-number">7.</span> <span class="nav-text">作者声明</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
</script>

<div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">白宁超</span>

  

  
</div>




  



  <!--<div class="powered-by">由 <a class="theme-link" target="_blank" rel="external nofollow" href="https://hexo.io">Hexo</a> 强力驱动 v3.7.1</div> -->



   <!--<span class="post-meta-divider">|</span>-->



   <!--<div class="theme-info">主题 – <a class="theme-link" target="_blank" rel="external nofollow" href="https://theme-next.org">NexT.Gemini</a> v6.4.1</div>-->




        <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>



<div class="busuanzi-count">
  
    <span class="site-uv" title="总访客量">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="site-pv" title="总访问量">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.4.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.4.1"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=6.4.1"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=6.4.1"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.4.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.4.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.4.1"></script>



  



  
    <script type="text/javascript">
      window.livereOptions = {
        refer: '2018/10/10/编程数学之概率分布/'
      };
      (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
      })(document, 'script');
    </script>
  










  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
  

  
  

  
    
      <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      tex2jax: {
        inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
        processEscapes: true,
        skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      },
      TeX: {equationNumbers: { autoNumber: "AMS" }}
    });
</script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
    });
</script>
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/mathjax@2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

    
  


  
  
  
  <script src="/lib/needsharebutton/needsharebutton.js"></script>

  <script>
    
      pbOptions = {};
      
          pbOptions.iconStyle = "box";
      
          pbOptions.boxForm = "horizontal";
      
          pbOptions.position = "bottomCenter";
      
          pbOptions.networks = "Weibo,Wechat,Douban,QQZone,Linkedin,Facebook";
      
      new needShareButton('#needsharebutton-postbottom', pbOptions);
    
    
  </script>

  

  

  

  

  

  

  <!-- 页面点击小红心 -->
	<script type="text/javascript" src="../js/src/love.js"></script><!-- hexo-inject:begin --><!-- Begin: Injected MathJax -->
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({"tex2jax":{"inlineMath":[["$","$"],["\\(","\\)"]],"skipTags":["script","noscript","style","textarea","pre","code"],"processEscapes":true},"TeX":{"equationNumbers":{"autoNumber":"AMS"}}});
</script>

<script type="text/x-mathjax-config">
  MathJax.Hub.Queue(function() {
    var all = MathJax.Hub.getAllJax(), i;
    for(i=0; i < all.length; i += 1) {
      all[i].SourceElement().parentNode.className += ' has-jax';
    }
  });
</script>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js">
</script>
<!-- End: Injected MathJax -->
<!-- hexo-inject:end -->
</body>
</html>
